<?php

// +----------------------------------------------------------------------
// |Author: 翼小菜
// +----------------------------------------------------------------------
// |Description: 上传
// +----------------------------------------------------------------------
// |更多功能可联系QQ314688769
// +----------------------------------------------------------------------
namespace api\cveadmin\controller;
use cmf\controller\RestUserBaseController;
use cmf\lib\Upload;
use think\facade\View;
class UploadController extends RestUserBaseController
{
    public function index()
    {
        if ($this->request->isPost()) {

            $uploader = new Upload();
            $uploader->setUploadDir(CMF_DATA . 'upload/tmp/');
            $uploader->setPrivate(true);
            $result = $uploader->upload();

            if ($result === false) {
                $this->error($uploader->getError());
            } else {
                $this->success(lang('Upload successful'), $result);
            }

        }
    }
}
